﻿@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/MyLayout.cshtml";
}

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<link href="~/Content/bootstrap/css/style.css" rel="stylesheet" />
<link href="~/Content/bootstrap/css/base.css" rel="stylesheet" />
<script src="~/Scripts/jquery-2.1.1.min.js"></script>
<link href="~/Scripts/datejs/datecss.css" rel="stylesheet" />
<script src="~/Scripts/layer/layer.js"></script>
<script src="~/Scripts/Common.js"></script>
<script src="~/Scripts/layPage/laypage.js"></script>
<script src="~/Scripts/datejs/jquery-ui-1.10.4.custom.min.js"></script>
<script src="~/Scripts/datejs/jquery-ui-timepicker-addon.js"></script>
<link href="~/Scripts/css/gloabcss.css" rel="stylesheet" />
<script src="~/Scripts/flashupload.js"></script>
<style>
    input {
        width: 12%;
        height: 25px;
        margin-left: 15px;
    }

    .span8 input {
        width: 30%;
    }

    .container-fluid {
        margin: 0;
        padding: 0;
    }

    #edit_agency p {
        padding-top: 15px;
    }

    table tr td {
        padding: 12px 0px 12px 0px;
    }

    #Paging {
        position: absolute;
        float: right;
        left:20%;
        margin-top: 1%;
    }


    /*/*/
    #div_cr_box span {
        text-align: right;
    }

    .box_cen {
        float: left;
        width: 85%;
    }

    .uploadify {
        float: left;
        margin-left: 15px;
    }

    .uploadify-button {
        background: #00AAEE;
        border-radius: 0px;
        border: 2px solid #00AAEE;
        font-size: 14px;
        color: #FFF;
        cursor: pointer;
    }

        .uploadify-button:hover {
            background: #00AAEE;
            border-radius: 0px;
            border: 2px solid #00AAEE;
            font-size: 14px;
            color: #FFF;
            cursor: pointer;
        }

    .uploadify:hover .uploadify-button {
        background: #00AAEE;
        border-radius: 0px;
        border: 2px solid #00AAEE;
        font-size: 14px;
        color: #FFF;
        cursor: pointer;
    }

    .file_input {
        width: 19.3%;
        border: 1px solid #c1c1c1;
        height: 25px;
        font-size: 14px;
        color: #4d4d4d;
        padding-left: 10px;
        line-height: 25px;
        width: 98%;
    }
    .text_left {
     text-align:left;
    }
</style>
<script>
    var hiden_type = 1;
    //窗体加载
    $(function () {
        hiden_type = $("#hiden_type").val();
        if (hiden_type != 1) {
            $("#btn_opea,#btn_add,#btn_Export,#div_daoru").remove();
        }
        SearchList();
        GetCategory();
        GetLevel();
       
        $("input[name='start_time']").datetimepicker();
        $('#uploader').FileUpload({
            'uploader': "../../aspx/FileUpload.ashx",
            'subfolder': 'Excel',
            'queueID': 'fileQueue',
            'callback': function (data) {
                var imgurl = data.msg.url;
                $("#file_Excel").val(imgurl);
                var fileValue = $("#file_Excel").val();
                var fileExt = fileValue.substr(fileValue.lastIndexOf('.')).toLowerCase();
                if (fileExt == ".xls" || fileExt == ".xlsx" || fileExt == ".csv") {
                } else {
                    $("#file_Excel").val("");
                    layer.msg("请选择excel文件");
                }
            }
        });
    })
    //逻辑删除
    function del(obj, id) {
        layer.open({
            type: 1,
            btn: ['确定', '取消'],
            title: '删除',
            skin: "layui-layer-molv",
            area: ['200px', '135px'],
            shade: 0.3,
            content: "你确定要删除吗",
            btn1: function () {
                $.ajax({
                    type: "POST",
                    url: "/Agency/delete",
                    dataType: "json",
                    data: { "id": id },
                    success: function (data) {
                        // layer.alert(JSON.stringify(data));
                        if (data.MessageCode == "0") {
                            layer.msg("删除成功！");
                            setTimeout(function () {
                                window.location.reload();
                            }, 2000)
                        } else {
                            layer.msg("删除失败！");
                        }
                    }
                });
            },
            btn2: function () {
                layer.close();
            }
        });
    }
    //查询出要编辑的人的信息
    function GetAgency(id) {
        $.ajax({
            type: "GET",
            url: "/Agency/GetAgency",
            data: { "id": id },
            dataType: "json",
            async: false,
            success: function (data) {
                if (data.MessageCode == "0") {
                    var st = formatDateTime(data.model.start_time);
                    $("#div_pwd").show();
                    $("#txt_pwd").val(data.pwd);
                    $("#txt_name").val(data.model.name);
                    $("#txt_companyName").val(data.model.company_name);
                    $("#txt_contract_name").val(data.model.contract_name);
                    $("#txt_mobile").val(data.model.mobile);
                    $("#txt_qqCode").val(data.model.qq);
                    $("#txt_wxopen").val(data.model.wx_openid);
                    $("#txt_wwCode").val(data.model.ww_code);
                    $("#txt_idcard").val(data.model.id_card);
                    $("#txt_shopurl").val(data.model.shop_url);
                    $("#txt_start_time").val(st);
                    $("#sel_Category").val(data.model.category_id);
                    $("#sel_Level").val(data.model.level_id);
                    
                    $("input[name='l_shouquan']").each(function (m, k) {
                        if ($(this).val() == data.model.state) {

                            $("input[name='l_shouquan']").eq(m).attr("checked", "checked");
                        }

                    })
                    $("input[name='l_shenhe']").each(function (m, k) {

                        if ($(this).val() == data.model.shState) {

                            $("input[name='l_shenhe']").eq(m).attr("checked", "checked");
                        }

                    })
                    $("input[name='l_fz']").each(function (m, k) {

                        if ($(this).val() == data.model.share_state) {

                            $("input[name='l_fz']").eq(m).attr("checked", "checked");
                        }

                    })
                }
            }
        });
    }


    //添加和修改
    function opeation(obj, id, opea) {

        $("#add_agency").find("input[type='text'],input[type='number']").val("");
        var msg = "添加用户信息";
        if (opea == 'edit') {
            
            GetAgency(id);
            msg = "修改用户信息";
        }
        layer.open({
            type: 1,
            btn: ['确定', '取消'],
            title: '' + msg + '',
            skin: "layui-layer-molv",
            area: ['600px', '630px'],
            shade: 0.3,
            content: $('#add_agency'),
            btn1: function () {
                if (CheckInputNullAll("add_agency")) {

                    var chk_lenth = $("input[name='l_shouquan']:checked").length;
                    if (chk_lenth <= 0) {
                        layer.msg("请选择是否授权！");
                        return false;
                    }
                    var chk_sh_lenth = $("input[name='l_shenhe']:checked").length;
                    if (chk_sh_lenth <= 0) {
                        layer.msg("请选择是否审核！");
                        return false;
                    }
                    var txt_name = $("#txt_name").val();
                    var txt_companyName = $("#txt_companyName").val();
                    var txt_contract_name = $("#txt_contract_name").val();
                    var txt_mobile = $("#txt_mobile").val();
                    var txt_qqCode = $("#txt_qqCode").val();
                    var txt_wxopen = $("#txt_wxopen").val();
                    var txt_wwCode = $("#txt_wwCode").val();
                    var txt_idcard = $("#txt_idcard").val();
                    var txt_shopurl = $("#txt_shopurl").val();
                    var txt_start_time = $("#txt_start_time").val();
                    var sel_Category = $("#sel_Category").val();
                    var sel_Level = $("#sel_Level").val();
                    
                    var level_name = $('#sel_Level').find("option:selected").text();
                    var state = $("input[name='l_shouquan']:checked").val();
                    var shState = $("input[name='l_shenhe']:checked").val();
                    var share_state = $("input[name='l_fz']:checked").val();
                    var coding = $('#sel_Level').find("option:selected").attr("coding")
                    if (sel_Level == -1 || sel_Level == "") {
                        layer.msg("请选择客户级别！");
                        return false;
                    }
                    if (sel_Category == -1 || sel_Category == "") {
                        layer.msg("请选择客户类别！");
                        return false;
                    }
                    
                    $.ajax({
                        type: "POST",
                        url: "/Agency/OpeaAgency",
                        dataType: "json",
                        data: { "opea": opea, "id": id, "Name": txt_name, "companyName": txt_companyName, "contract_name": txt_contract_name, "mobile": txt_mobile, "qq": txt_qqCode, "wxOpenid": txt_wxopen, "wwCode": txt_wwCode, "idCard":

txt_idcard, "shopUrl": txt_shopurl, "category_id": sel_Category, "level_id": sel_Level, "level_name": level_name, "start_time": txt_start_time, "state": state, "coding": coding, "shState": shState, "share_state": share_state
                        },
                        success: function (data) {
                            if (data.MessageCode == "0") {
                                layer.msg(opea == "edit" ? "修改成功!" : "添加成功！");
                                setTimeout(function () {
                                    SearchList();
                                }, 2000)
                            } else if (data.MessageCode == "50") {
                                layer.msg("信息存在重复!");
                            } else {
                                layer.msg(opea == "edit" ? "修改失败" : "添加失败！");
                            }
                        }
                    });
                }
            },
            btn2: function () {
                layer.close();
            }
        })
    }
    function Textsub(obj,lengs)
    {
        if (obj.length > lengs) {
            return obj.substring(0, lengs) + "...";

        } else {
            obj
        }


    }
    //模糊查询
    function queryagency(pageindex, pagesize) {
        var pagecount;
        var keys = $('#sel_key').val();
        var keyName = $('#txt_keyName').val();
        var category_id = $('#sel_leibie').val();
        var zhuangtai = $('#sel_shouquan').val();
        //var state = $('#states').val();
        $.ajax({
            type: "GET",
            url: "/Agency/queryagency",
            data: { "pageindex": pageindex, "pagesize": pagesize, "keys": keys, "keyName": keyName, "category_id": category_id, "zhuangtai": zhuangtai },
            dataType: "json",
            async: false,
            success: function (data) {
                $("#tab_product  tr:not(:first)").remove();
                // layer.alert(JSON.stringify(data));
                pagecount = data.Pagecount;
                if (data.MessageCode = "0") {
                    if (data.Agencylist != null) {
                        if (hiden_type == 1) {
                            $.each(data.Agencylist, function (i, n) {
                                var state = n.state == "0" ? "未授权" : n.state == "1" ? "已授权" : "放弃";
                                var shState = n.shState == "0" ? "待审核" : n.shState == "1" ? "已审核" : "放弃";
                                var au_code = n.au_code != null ? n.au_code : "";
                                var s_html = n.states == "待授权" ? "待授权" : n.states == "已授权" ? "<a href=\"" + n.sq_img + "\" target=\"_blank\" title=\"点击可以查看授权证书\">已授权</a>" : n.states == "已放弃" ? "已放弃" : "已过期";
                                var html = "<tr class='rep-tab-tr1 back-f9f text_left'>" +
                                                                "<td>" + n.id + "</td>" +
                                                                "<td>" + n.name + "</td>" +
                                                                  "<td>" + au_code + "</td>" +
                                                                 "<td>" + n.categoryName + "</td>" +
                                                                   "<td style=\"text-align:center;\" title=" + n.levelName +">" + Textsub(n.levelName, 3) + "</td>" +
                                                                "<td style=\"text-align:center;\">" + n.wx_openid + "</td>" +
                                                                "<td>" + n.contract_name + "</td>" +
                                                                "<td>" + n.mobile + "</td>" +
                                                                 "<td>" + s_html + "</td>" +
                                                                  "<td>" + shState + "</td>" +
                                                                "<td><input type='button' value='编辑' onclick='opeation(this," + n.id + ",\"edit\")' style='width:25%;height:22px;margin-left:5px;cursor:pointer;border:none;color:#55AC58;'/><input type='button' value='查看' onclick='lookList(this," + n.id + ")' style='width:25%;height:22px;margin-left:5px;cursor:pointer; border:none;color:#55AC58;'/><input type='button' value='删除'onclick='del(this," + n.id + ")' style='width:25%;height:22px; margin-left:5px;cursor:pointer;border:none;color:#55AC58;'/></td></tr>";
                                $("#tab_product").append(html);
                            });
                        } else {

                            $.each(data.Agencylist, function (i, n) {
                                var au_code = n.au_code != null ? n.au_code : "";
                                var state = n.state == "0" ? "未授权" : n.state == "1" ? "已授权" : "放弃";
                                var shState = n.shState == "0" ? "待审核" : n.shState == "1" ? "已审核" : "放弃";
                                var s_html = n.states == "待授权" ? "待授权" : n.states == "已授权" ? "<a href=\"" + n.sq_img + "\" target=\"_blank\" title=\"点击可以查看授权证书\">已授权</a>" : n.states == "已放弃" ? "已放弃" : "已过期";
                                var html = "<tr class='rep-tab-tr1 back-f9f text_left'>" +
                                                                "<td>" + n.id + "</td>" +
                                                                "<td>" + n.name + "</td>" +
                                                                  "<td>" + au_code + "</td>" +
                                                                "<td>" + n.categoryName + "</td>" +
                                                                   "<td style=\"text-align:center;\" title=" + n.levelName + ">" + Textsub(n.levelName, 3) + "</td>" +
                                                                "<td style=\"text-align:center;\">" + n.wx_openid + "</td>" +
                                                                "<td>" + n.contract_name + "</td>" +
                                                                "<td>" + n.mobile + "</td>" +
                                                                 "<td>" + s_html + "</td>" +
                                                                     "<td>" + shState + "</td>" +
                                                                "<td><input type='button' value='查看' onclick='lookList(this," + n.id + ")' style='width:70%;height:22px;margin-left:5px;cursor:pointer; border:none;color:#55AC58;'/></tr>";
                                $("#tab_product").append(html);
                            });

                        }
                    } else {
                        layer.msg("暂无数据!");

                    }
                } else {

                    layer.msg("查询失败，请稍后再试!!");
                }
            }
        })
        return pagecount;
    }
    //授权和放弃授权
    function authorization(obj, id, opea) {
        var title = opea == "yes" ? "授权" : "放弃授权";
        var width = opea == "yes" ? "350px" : "200px";
        var height = opea == "yes" ? "300px" : "135px";
        var con = opea == "yes" ? $('#sel_name') : "是否放弃授权?";
        var state = opea == "yes" ? 1 : 2;
        layer.open({
            type: 1,
            btn: ['确定', '取消'],
            title: title,
            skin: "layui-layer-molv",
            area: [width, height],
            shade: 0.3,
            content: con,
            btn1: function () {
                var levelName = $('#sel_levels').find("option:selected").text();
                var level_id = $('#sel_levels').val();
                var start_times = $("#start_Time").val();
                var end_times = $("#end_Time").val();
                if (state == 1) {
                    //alert(levelName);
                    if (levelName == "请选择") {
                        layer.msg("请选择类别！");
                        return false;
                    }
                    if (levelName == "") {
                        layer.msg("请选择类别！");
                        return false;
                    }
                    if (start_times == "") {
                        layer.msg("请填写授权开始时间！");
                        return false;
                    }
                    if (end_times < start_times) {
                        layer.msg("授权结束时间要大于授权开始时间！");
                        return false;
                    }
                } else {
                    levelName = "";
                    level_id = 0;
                    start_times = "1991/01/01";
                    end_times = "1991/01/01";
                }
                $.ajax({
                    type: "POST",
                    url: "/Index/UptPassOrNo",
                    data: { "id": id, "state": state, "level_id": level_id, "start_time": start_times, "end_time": end_times, "levelName": levelName },
                    dataType: "json",
                    async: false,
                    success: function (data) {
                        //alert(JSON.stringify(data));
                        if (data == true) {
                            layer.msg(state == 1 ? "授权成功!" : "放弃成功!");
                            setTimeout(function () {
                                SearchList();
                            }, 2000)
                        } else {
                            layer.alert("操作失败！");
                        }
                    }
                });
            },
            btn2: function () {
                layer.close();
            }
        });
    }


    //分页
    function SearchList() {
        var pagecount = queryagency(1, 8);
        //好像很实用的样子，后端的同学再也不用写分页逻辑了。
        laypage({
            cont: 'pager',
            pages: pagecount, //可以叫服务端把总页数放在某一个隐藏域，再获取。假设我们获取到的是18
            skip: true, //是否开启跳页
            skin: '#5c86b2',
            curr: function () { //通过url获取当前页，也可以同上（pages）方式获取
                var page = location.search.match(/page=(\d+)/);
                return page ? page[1] : 1;
            }(),
            jump: function (e, first) { //触发分页后的回调
                if (e.pages > 1) { $('#pagercount').html('共' + e.pages + '页'); } else { $('#pagercount').hide(); }
                $('.laypage_skip').val(e.curr);
                if (!first) { //一定要加此判断，否则初始时会无限刷新
                    queryagency(e.curr, 8);
                }
            }
        });
    }

    //添加级别
    function Add_Jb() {
        layer.open({
            type: 2,
            title: "级别管理",
            area: ['1000px', '500px'],
            fix: false, //不固定
            maxmin: true,
            scrollbar: true,
            content: '/Level/Index'

        });
    }
    //添加类别
    function Add_Lb() {
        layer.open({
            type: 2,
            title: "类别管理",
            area: ['1000px', '500px'],
            fix: false, //不固定
            maxmin: true,
            scrollbar: true,
            content: '/category/Index'

        });
    }
    //查看历史记录
    function lookList(obj, id) {
        layer.open({
            type: 2,
            title: "授权历史记录",
            area: ['1150px', '650px'],
            fix: false, //不固定
            maxmin: true,
            scrollbar: true,
            content: '/Authorization/Index?agency_id=' + id

        });

    }
    function btn_daoru()
    {
        var file_Excel = $("#file_Excel").val();
        if (file_Excel == "")
        {
            layer.msg("请选择要上传的Excel文件！");
            return false;
        }
        $.ajax({
            type: "POST",
            url: "/Agency/ImpoertList",
            dataType: "json",
            data: { "filepath": file_Excel },
            success: function (data) {
                $("#file_Excel").val("");
                if (data.MessageCode == "0") {
                    layer.msg("导入成功！");
                    setTimeout(function () {
                        SearchList();
                    }, 2000)
                } else if (data.MessageCode == "50") {
                    $("#tab_daoruList  tr:not(:first)").remove();
                    $.each(data.list, function (i, n) {
                        var html = "<tr class='rep-tab-tr1 back-f9f'>" +
                                                        "<td>" + n.name + "</td>" +
                                                        "<td>" + n.company_name + "</td>" +
                                                           "<td>" + n.mobile + "</td>" +
                                                        "<td>" + n.contract_name + "</td>" +
                                                        "<td>" + n.qq + "</td>" +
                                                         "<td>" + n.wx_openid + "</td>" +
                                                          "<td>" + n.ww_code + "</td>" +
                                                           "<td>" + n.id_card + "</td>" +
                                                        "<td>" + n.shop_url + "</td></tr>";
                        $("#tab_daoruList").append(html);
                    });

                    layer.open({
                        type: 1,
                        btn: ['确定', '取消'],
                        title: '<span style="color:green;">成功'+data.count+'条</span><span style="color:red;padding-left:15px;">信息存在重复,请检查<span>',
                        skin: "layui-layer-molv",
                        area: ['1000px', '500px'],
                        shade: 0.3,
                        content: $('#Dao_List'),
                        btn1: function () {
                            SearchList();
                        },
                        btn2: function () {
                            layer.close();
                        }
                    });
                } else {
                    layer.msg("导入失败！");
                }
            }
        });

    }
</script>
<input type="hidden" value="@ViewData["hiden_type"]" id="hiden_type" />
<div class="rightoverflow">
    <div class="ove-hid">
        <div class="wid-100 cor-4d4 fon-siz20 lin-hei60 bor-bot999">
            <div class="flo-lef">&nbsp;&nbsp;&nbsp;&nbsp;<span><i class="fa fa-gear"></i></span><span>客户管理</span></div>
            <div id="btn_opea" style="padding-right:3%;">
                <div class="flo-rig">
                    &nbsp;&nbsp;&nbsp;&nbsp;<span><i class="fa fa-gear"></i></span><span>
                        <input type="button" value="级别管理" onclick="Add_Jb()" style=" color: white; border: none; width:100px; height: 30px; font-

weight: bold; margin-bottom: 10px; background-color: #FF8302; ">
                    </span>
                </div>
                <div class="flo-rig">
                    &nbsp;&nbsp;&nbsp;&nbsp;<span><i class="fa fa-gear"></i></span><span>
                        <input type="button" value="类别管理" onclick="Add_Lb()" style=" color: white; border: none; width:100px; margin-right:20px;

height: 30px; font-weight: bold; margin-bottom: 10px; background-color: #FF8302; ">
                    </span>
                </div>
            </div>
        </div>

    </div>
    <div class="ove-hid">
        <div class="wid-120 cor-4d4 fon-siz20 lin-hei60 bor-botdcd ">
        </div>
    </div>
    <div class="ove-hid">
        <div class="Rep-main wid-100 mag-top50">
            <div style=" margin-left: 5%;">
                @using (Html.BeginForm("ExportList", "Agency", FormMethod.Get, new { id = "Exp" }))
                {
                    <div>
                        查询条件:&nbsp;<select class="selects" id="sel_key" name="keys">
                            <option value="-1">请选择</option>
                            <option value="0">商家名称</option>
                            <option value="1">手机号码</option>
                            <option value="2">旺旺号码</option>
                        </select>
                        <input type="text" placeholder="  输入关键字查询" id="txt_keyName" name="keyName" />
                        客户类别:&nbsp;<select class="selects" id="sel_leibie" name="leibie">
                            <option value="-1">请选择</option>
                        </select>
                        状态:&nbsp;<select class="selects" id="sel_shouquan" name="shouquan">
                            <option value="请选择">请选择</option>
                            <option value="待授权">待授权</option>
                            <option value="已授权">已授权</option>
                            <option value="已放弃">已放弃</option>
                            <option value="已过期">已过期</option>
                        </select>
                        <input type="button" value="查询" onclick="SearchList();" style=" color: white; border: none; width: 7%; height: 30px; font-weight: bold; margin-bottom: 10px; background-color: #FF8302; " />
                        <input type="button" value="添加" id="btn_add" onclick="opeation(this,0,'add');" style=" color: white; border: none; width: 7%; height: 30px; font-weight: bold; margin-bottom: 10px; background-color: #FF8302; " />
                        <input type="submit" value="导出" id="btn_Export" style=" color: white; border: none; width: 7%; height: 30px; font-weight: bold; margin-bottom: 10px; background-color: #FF8302; " />



                    </div>
                }
                <div id="div_daoru">
                    <div style=" float:left; width:200px;">
                        <span>
                            导入文件: <input id="file_Excel" placeholder="选择excel文件上传" name="file_image" type="text" class="file_input" style="width:129px;padding-left:0px;margin-left:0px;height:30px;" readonly="readonly">
                        </span>
                    </div>
                    <div id="uploader" style=" float:left;">
                    </div>
                    <div style=" float: left; margin-left: 15px; margin-right: 15px;">
                        <input type="submit" value="导入" id="btn_Export" onclick="btn_daoru();" style=" color: white; border: none; width:60px; height: 30px; font-weight: bold; margin-bottom: 10px; background-color: #FF8302; " />
                    </div>
                    <div style=" float: left; height:30px; line-height:30px;">
                        <a href="\Template\模板.xlsx">模板下载</a>
                    </div>
                </div>
            </div>


            <div class="pro-div" id="con_two_1">
                <table class="rep-tab wid-100 cor-4d4 tex-ali" id="tab_product">
                    <thead>
                        <tr>
                            <td>序列号</td>
                            <td style="text-align:left;">客户名称</td>
                            <td style="text-align:left;">授权编号</td>
                            <td style="text-align:left;">类别</td>
                            <td>级别</td>
                            <td>微信号</td>
                            <td>联系人</td>
                            <td>手机</td>
                            <td>授权状态</td>
                            <td>审核状态</td>
                            <td>操作</td>
                        </tr>
                    </thead>
                </table>
            </div>
        </div>
    </div>
</div>
<div id="sel_name" style="display: none; text-align: left;">
    <p>
        <span>客&nbsp;户&nbsp;类&nbsp;别：</span> <select class="selects" id="sel_levels" par="par" style="width: 220px;">
            <option value="-1">请选择</option>
        </select>
    <p><span>申&nbsp;请&nbsp;时&nbsp;间：</span><input type="text" name="start_Time" id="start_Time" style="width: 211px; margin-left:5px;" readonly="readonly" class="inp-textmor" par="par" /></p>
    <p><span>到&nbsp;期&nbsp;时&nbsp;间：</span><input type="text" name="end_Time" id="end_Time" readonly="readonly" style="width: 211px; margin-left: 5px;" class="inp-textmor" par="par" /></p>

</div>
<div id="add_agency" style="display:none;">
    <div class="divLeft"> <div class="divSpan"><span>商家名称:</span></div><div class="divInput"><input type="text" id="txt_name" placeholder="请输入商家名称" class="required" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>公司名称:</span></div><div class="divInput"><input type="text" id="txt_companyName" placeholder="请输入公司名称" class="required" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>联系人:</span></div><div class="divInput"><input type="text" id="txt_contract_name" placeholder="请输入联系人姓名" class="required" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>手机号:</span></div><div class="divInput"><input type="text" id="txt_mobile" placeholder="请输入正确的手机号" class="tel required" /></div></div>
    <div class="divLeft" id="div_pwd" style="display:none;"> <div class="divSpan"><span>密码:</span></div><div class="divInput"><input type="text" id="txt_pwd" disabled="disabled" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>QQ号:</span></div><div class="divInput"><input type="text" id="txt_qqCode" placeholder="请输入QQ号" class="required" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>微信号:</span></div><div class="divInput"><input type="text" id="txt_wxopen" placeholder="请输入微信号" class="required" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>旺旺号:</span></div><div class="divInput"><input type="text" id="txt_wwCode" placeholder="请输入旺旺号" class="required" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>身份证号:</span></div><div class="divInput"><input type="text" id="txt_idcard" placeholder="请输入正确身份证号" class="sfz" /></div></div>
    <div class="divLeft"> <div class="divSpan"><span>店铺网址:</span></div><div class="divInput"><input type="text" id="txt_shopurl" placeholder="请输入店铺网址" class="required" /></div></div>
    <div class="divLeft">
        <div class="divSpan"><span>客户级别:</span></div><div class="divInput">
            <select style="margin-left: 15px;width: 85%;height: 25px;" id="sel_Level">
                <option value="-1">请选择</option>
            </select>
        </div>
    </div>
    <div class="divLeft">
        <div class="divSpan"><span>客户类别:</span></div><div class="divInput">
            <select style="margin-left: 15px;width: 85%;height: 25px;" id="sel_Category">
                <option value="-1">请选择</option>
            </select>
        </div>
    </div>
    
    <div class="divLeft"> <div class="divSpan"><span>授权时间(始):</span></div><div class="divInput"><input type="text" name="start_time" id="txt_start_time" placeholder="请选择授权开始时间" class="required" /></div></div>

    <div class="divLeft">
        <div class="divSpan"><span>是否授权:</span></div><div class="divInput">
            <input class="huodongchk" type="radio" name="l_shouquan" id="l_sq" value="1" style="width:20px; height:20px;" /><label for="l_sq">授权</label>
            <input class="huodongchk" type="radio" name="l_shouquan" id="l_fq" value="2" style="width: 20px; height: 20px;" /><label for="l_fq">放弃</label>
        </div>
    </div>
    <div class="divLeft">
        <div class="divSpan"><span>是否审核:</span></div><div class="divInput">
            <input class="huodongchk" type="radio" name="l_shenhe" id="l_sh" value="1" style="width:20px; height:20px;" /><label for="l_sh">审核</label>
            <input class="huodongchk" type="radio" name="l_shenhe" id="l_bsh" value="2" style="width: 20px; height: 20px;" /><label for="l_bsh">不审核</label>
        </div>
    </div>
    <div class="divLeft">
        <div class="divSpan"><span>是否发展下级:</span></div><div class="divInput">
            <input class="huodongchk" type="radio" name="l_fz" id="l_fz" value="1" style="width:20px; height:20px;" /><label for="l_fz">是</label>
            <input class="huodongchk" type="radio" name="l_fz" id="l_bfz" value="0" style="width: 20px; height: 20px;" /><label for="l_bfz" >否</label>
        </div>
    </div>
</div>
<div style="display:none" id="Dao_List">
    <div class="pro-div" id="con_two_1">
        <table class="rep-tab wid-100 cor-4d4 tex-ali" id="tab_daoruList">
            <thead>
                <tr class="text_left">
                    <td>商家名称</td>
                    <td>公司名称</td>
                    <td>手机号码</td>
                    <td>联系人</td>
                    <td>QQ号</td>
                    <td>微信号</td>
                    <td>旺旺号</td>
                    <td>身份证号</td>
                    <td>网址</td>
                </tr>
            </thead>
        </table>
    </div>

</div>

<div id="Paging">
    <span id="pagercount" style="float:left "></span>
    <div id="pager" class="pager" style="float:left">
    </div>
</div>
<input type="hidden" id="uidHidden" />
<input type="hidden" id="AgidHidden" />
<script>

    //下拉框信息
    function GetCategory() {
        $("#sel_Category").html("<option value=\"-1\" code=\"0\">请选择</option>");

        $.ajax({
            type: "GET",
            url: "/Category/GetCategoryName",
            dataType: "json",
            data: {},
            success: function (data) {
                if (data.list != "") {
                    $.each(data.list, function (i, n) {
                        $("#sel_Category").append("<option value='" + n.id + "'>" + n.name + "</option>");
                        $("#sel_leibie").append("<option value='" + n.id + "'>" + n.name + "</option>");
                    });
                }
            }
        });
    }
     
    function GetLevel() {
        $("#sel_level").html("<option value=\"-1\" code=\"0\">请选择</option>");

        $.ajax({
            type: "GET",
            url: "/Level/GetLevelName",
            dataType: "json",
            data: {},
            success: function (data) {
                if (data.list != "") {
                    $.each(data.list, function (i, n) {
                        $("#sel_Level").append("<option value='" + n.id + "' coding=\"" + n.coding + "\">" + n.name + "</option>");
                    });
                }
            }
        });
    }
</script>
